package com.example.qiniutest.aliyun.ocr.controller;

import com.aliyun.ocr20191230.models.RecognizeVATInvoiceResponseBody;
import com.example.qiniutest.aliyun.ocr.service.IOcrService;
import com.example.qiniutest.util.R;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author : xpp011
 * @create 2021/12/24 15:47
 */
@RestController
@RequestMapping("aliyun-ocr")
public class OcrController {

    @Autowired
    private IOcrService ocrService;

    /**
     *
     * @param downUrl  解析的单据的url必须为可下载的   Ocr会下载该图片进行解析
     * @param suffix   图片后缀必须为jpg
     * @return
     */
    @GetMapping("/parse")
    public RecognizeVATInvoiceResponseBody parse(@NonNull String downUrl, @NonNull String suffix){
        return ocrService.parse(downUrl,suffix);
    }
}
